home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / olecon~1 / include / dibcla~1.h < prev    next >
C/C++ Source or Header  |  1995-12-04  |  1KB  |  66 lines

  1. #ifndef __DIBCLASSES_H
  2. #define __DIBCLASSES_H
  3.  
  4.  
  5. //
  6. //    class CDibFile
  7. //
  8. class CDibFile 
  9. {
  10. public:
  11.     CDibFile();
  12.     ~CDibFile();
  13.     
  14.     HRESULT    GetFileHeader(IStream *);
  15.     HRESULT    GetInfoHeader(IStream *);
  16.  
  17.     DWORD    HeaderSize()            { return(m_headerSize); }
  18.     DWORD    CalcImageSize();
  19.  
  20.     operator BITMAPINFO * ()        { return(m_bmi.p); }
  21.     operator BITMAPINFOHEADER * ()    { return(&m_bmi.p->bmiHeader); }
  22.     
  23. private:
  24.     
  25.     DWORD    m_headerSize;
  26.     union 
  27.     {
  28.         BITMAPINFO *    p;
  29.         unsigned char *    bytes;
  30.     } m_bmi;
  31. };
  32.  
  33. class CDibSection
  34. {
  35. public:
  36.     CDibSection();
  37.     ~CDibSection();
  38.     
  39.     HRESULT Create    ( CDibFile& );
  40.     HRESULT    Setup    ( HDC basedOnThisDC);
  41.     HRESULT ReadFrom( IStream * strm, DWORD amount );
  42.     HRESULT    PaintTo    ( HDC hdc, int x = 0, int y = 0 );
  43.     HRESULT    GetSize    ( SIZEL &sz);
  44.  
  45.     DWORD    ImageSize() { return(m_imageSize); }
  46.     void    ImageSize(DWORD dw) { m_imageSize = dw; }
  47.  
  48.     operator HANDLE() { return m_handle; }
  49.  
  50.     unsigned char * Base() { return(m_bitsBase); }
  51.  
  52. private:
  53.     unsigned char *        m_bitsBase;
  54.     unsigned char *        m_current;
  55.     HDC                    m_memDC;
  56.     HBITMAP                m_handle;
  57.     HBITMAP                m_oldBitmap;
  58.     LONG                m_h;
  59.     LONG                m_w;
  60.     DWORD                m_imageSize;
  61. };
  62.  
  63.  
  64.  
  65. #endif __DIBCLASSES_H
  66.